#include "/home/yaojiayu/Code/Projects/P01_GateWay/app/app_buffer.h"
#include <assert.h>

int buffer_test()
{   
    /*初始化*/
    char str[16];
    Buffer buffer;
    app_buffer_init(&buffer,16);

    /*写测试*/
    app_buffer_write(&buffer,"Helloworld!",11);
    assert(buffer.len==11);
    assert(buffer.start==0);

    /*读测试*/
    app_buffer_read(&buffer,str,7);
    assert(buffer.len==4);
    assert(buffer.start==7);

    assert(strncmp(str,"Hellowo",7)==0);



    // app_buffer_write(&buffer,"JimmyYao",8);
    // assert(buffer.len==12);
    // assert(buffer.start==7);

    // app_buffer_read(&buffer,str,12);
    // assert(buffer.len==0);
    // assert(buffer.start==3);
    // assert(strncmp(str,"rld!JimmyYao",12)==0);

    return 0;
}
